/*
 *  Templates for Sedit.
 *  David Shayer, SQA Tools Team, Apple Computer Inc.
 *  Copyright © 1988.
 *
 *  The MPW command to run to compile the resource file:
    rez -o Template.rsrc -t rsrc -c RSED -a Template.r
 *
 *  Note that field names can only be 6 chars long.
 *  Template names can be as long as desired.
 */


/* resource template type definition */
type 'STMP'
{
	longint = $$CountOf(fields);	/* number of fields */
	array fields
	{
		pString[6];					/* field name		*/
		align word;
		longint;					/* field size		*/
	};
};


/*
 *  Templates are used to format the data shown in the data windows.
 *  Since disks are block devices, a template formats one block of data.
 *  (A block is often 512 bytes, but can be other sizes - it varies from 
 *  device to device.  So templates should not depend upon one block size.)
 *  Templates are set up by the user (there are some supplied), and
 *  are stored in resources, which are read in at launch.  The resource
 *  name becomes the template name.  Names are not case sensitive.
 *  There are some special names:
 *    Default - the format to use if none is specified.  
 *    Sense Check - the format to use for sense check error info
 *    Inquiry - the format to use for scsi inquiry call data
 *    Mode Sense - the format to use for scsi mode sense call data
 *    Read Cap - the format to use for scsi read capacity call data
 *    TIB - used to set up TIB's for custom scsi calls
 *    6 Byte SCSI Cmd, 10 Byte SCSI Cmd, 12 Byte SCSI Cmd - used to
 *              set up scsi command blocks for custom scsi calls
 *    DCI - used to display data chaining instructions for custom scsi calls
 *    ParamBlock - displays the SCSIReq param block to the SCSI atomic call
 *  Note: the default template must be present, or Sedit won't run.  The
 *  other templates listed above are called standard templates, Sedit
 *  knows them by name, and will use them if they are present, or will
 *  use the default template if it can't find them.  You can add your
 *  own template resources, Sedit won't use them automatically but will
 *  let you select them from the menu.  The other templates in this file
 *  (Driver Map, Old Part Map, New Part Map) are for your convenience 
 *  only, they are not required.  The standard templates names are stored
 *  in a STR# resource if you wish to change their names.
 *
 *  Field name is trimmed to 6 chars.  Field name is not case sensitive.
 *  Size must be between 0 and 16.
 *  There are some special field names:
 *    Skip - don't display this field, or, skip this much data.
 *    Addr - replace this name with the address of this data
 *           (the offset of the first byte of the field's data from
 *           the beginning of the block)
 *    Repeat - repeat the last x fields y times, where x is the loword
 *           of Size and y is the hiword of Size.  If y is zero, it means
 *           repeat the last x fields until you have displayed all the
 *           data in the buffer.  You cannot nest repeats.
 */

/* Resource Declarations*/

/* The default template is required by Sedit */
resource 'STMP' (1, "Default") 
{
	{
	"Addr",							/* subst real addr for "Addr"*/
	16,								/* 16 bytes					*/
	"Repeat",						/* repeat until out of data */
	0x00000001						
	}
};

/* The following templates are standard templates, Sedit knows them by 
   resource name, and will use them automatically if they are present */
/* The following templates are straight out of the ANSI SCSI spec */
resource 'STMP' (2, "Sense Check") 
{
	{
	"Error",						/* error class & error code	*/
	1,								/* 1 byte					*/
	"SegNum",						/* segment number			*/
	1,								/* 1 byte					*/
	"SenKey",						/* sense key (& bit codes)	*/
	1,								/* 1 byte					*/
	"Info",							/* information bytes		*/
	4,								/* 4 bytes					*/
	"AddLen",						/* additional sense length	*/
	1,								/* 1 byte					*/
	/* following is vendor unique */
	"AddSen",						/* additional sense bytes	*/
	11,								/* 11 bytes					*/
	"AddKey",						/* additional sense key		*/
	1,								/* 1 byte					*/
	"AddSen",						/* additional sense bytes	*/
	16,								/* as many bytes as sent	*/
	"Repeat",						/* repeat until out of data */
	0x00000001						
	}
};

resource 'STMP' (3, "Read Cap") 
{
	{
	"Blocks",						/* logical block address	*/
	4,								/* 4 bytes					*/
	"Size",							/* block length				*/
	4								/* 4 bytes					*/
	}
};

resource 'STMP' (4, "Inquiry") 
{
	{
	"DevTyp",						/* peripherial device type	*/
	1,								/* 1 byte					*/
	"Qualfy",						/* device type qualifier	*/
	1,								/* 1 byte					*/
	"BitCod",						/* ISO, ECMA, ANSI bit codes*/
	1,								/* 1 byte					*/
	"Reserv",						/* reserved					*/
	1,								/* 1 byte					*/
	"AddLen",						/* additional length		*/
	1,								/* 1 byte					*/
	/* following is vendor unique */
	"Data",							/* misc vendor data			*/
	3,								/* 3 bytes					*/
	"Mfg",							/* mfg name					*/
	8,								/* 16 bytes					*/
	"Prodct",						/* product name				*/
	16,								/* 8 more bytes				*/
	"DrvRev",						/* drive revision level		*/
	4,								/* 8 more bytes				*/
	"ROMRev",						/* rom revision level		*/
	8,								/* 8 more bytes				*/
	"Data",							/* misc vendor data			*/
	16,								/* as many bytes as sent	*/
	"Repeat",						/* repeat until out of data */
	0x00000001						
	}
};

resource 'STMP' (5, "Mode Sense") 
{
	{
	"SenLen",						/* sense data length		*/
	1,								/* 1 byte					*/
	"Medium",						/* medium type				*/
	1,								/* 1 byte					*/
	"Reserv",						/* reserved					*/
	1,								/* 1 byte					*/
	"DesLen",						/* block descriptor length	*/
	1,								/* 1 byte					*/
	"DCode",						/* density code				*/
	1,								/* 1 byte					*/
	"Blocks",						/* number of blocks			*/
	3,								/* 3 bytes					*/
	"Reserv",						/* resreved					*/
	1,								/* 1 byte					*/
	"BlkLen",						/* block length				*/
	3,								/* 3 bytes					*/
	"Vendor",						/* vendor unique info		*/
	16,								/* as many bytes as sent	*/
	"Repeat",						/* repeat until out of data */
	0x00000001						
	}
};

/* The following templates are for formatting custom scsi commands.
   These are also standard templates. */
resource 'STMP' (6, "TIB") 
{
	{
	"OpCode",						/* TIB OpCode				*/
	2,								/* 2 bytes					*/
	"Param1",						/* TIB parameter 1			*/
	4,								/* 4 bytes					*/
	"Param2",						/* TIB parameter 2			*/
	4,								/* 4 bytes					*/
	"Repeat",						/* repeat the previous 3 fields */
	0x00000003						/* repeat until out of data */
	}
};

resource 'STMP' (7, "6 Byte SCSI Cmd") 
{
	{
	"OpCode",						/* operation code			*/
	1,								/* 1 byte					*/
	"Block",						/* LUN & logical block addr	*/
	3,								/* 3 bytes					*/
	"Length",						/* transfer length			*/
	1,								/* 1 byte					*/
	"Ctrl",							/* control byte				*/
	1								/* 1 byte					*/
	}
};

resource 'STMP' (8, "10 Byte SCSI Cmd") 
{
	{
	"OpCode",						/* operation code			*/
	1,								/* 1 byte					*/
	"LUN",							/* logical unit number		*/
	1,								/* 1 byte					*/
	"Block",						/* logical block addr		*/
	4,								/* 4 bytes					*/
	"Reserv",						/* reserved					*/	
	1,								/* 1 byte					*/
	"Length",						/* transfer length			*/
	2,								/* 2 bytes					*/
	"Ctrl",							/* control byte				*/
	1								/* 1 byte					*/
	}
};

resource 'STMP' (9, "12 Byte SCSI Cmd") 
{
	{
	"OpCode",						/* operation code			*/
	1,								/* 1 byte					*/
	"LUN",							/* logical unit number		*/
	1,								/* 1 byte					*/
	"Block",						/* logical block addr		*/
	4,								/* 4 bytes					*/
	"Reserv",						/* reserved					*/	
	3,								/* 3 bytes					*/
	"Length",						/* transfer length			*/
	2,								/* 2 bytes					*/
	"Ctrl",							/* control byte				*/
	1								/* 1 byte					*/
	}
};

resource 'STMP' (10, "DCI") 
{
	{
	"dcAddr",						/* the buffer address or special opcode (dcLoop,dcStop)	*/
	4,								/* 4 bytes					*/
	"dCount",						/* number of bytes to transfer (dcMove) or loop count	*/
	4,								/* 4 bytes					*/
	"dcOfst",						/* buffer address offset (dcMove) or loop offset	*/
	4,								/* 4 bytes					*/
	"dcStor",						/* reserved storage	(part of saved Data pointer)	*/	
	4,								/* 4 bytes					*/
	"Repeat",						/* repeat the previous 4 fields */
	0x00000004						/* repeat until out of data */
	}
};

resource 'STMP' (11, "ParamBlock") 
{
	{
	"QLink",						/* link to next request block*/
	4,								/* 4 bytes					*/
	"privat",						/* private					*/
	4,								/* 2 bytes					*/
	"Vers",							/* param block version		*/
	2,								/* 2 bytes					*/
	"Result",						/* result code				*/	
	2,								/* 4 bytes					*/
	"CmpRtn",						/* address of completion routine*/
	4,								/* 4 bytes					*/
	"Data",							/* pointer to local storage	*/
	4,								/* 4 bytes					*/
	"ReqTO",						/* request timeout, in ms	*/
	4,								/* 2 bytes					*/
	"UFlags",						/* user flags				*/
	2,								/* 4 bytes					*/
	"SelTO",						/* selection timeout, in ms	*/
	2,								/* 1 byte					*/
	"MFlags",						/* scsi mgrs's flags		*/
	4,								/* 1 byte					*/
	"CLink",						/* link to next command		*/
	4,								/* 1 byte					*/
	"Bus",							/* bus number				*/
	1,								/* 1 byte					*/
	"scsiID",						/* scsi device id			*/
	1,								/* 2 bytes					*/
	"LUN",							/* logical unit number		*/
	1,								/* 4 bytes					*/
	"CmdLen",						/* command buffer length	*/
	1,								/* 4 bytes					*/
	"CmdBuf",						/* command buffer pointer	*/
	4,								/* 4 bytes					*/
	"DCIPtr",						/* ptr to DCI buffer		*/
	4,								/* 4 bytes					*/
	"DatLen",						/* requested data len		*/
	4,								/* 4 bytes					*/
	"DatXfr",						/* actual bytes transferred	*/
	4,								/* 1 byte					*/
	"SnsBfr",						/* ptr to sense data buffer	*/
	4,								/* 1 byte					*/
	"SnsLen",						/* length of sense buffer (>=4)*/
	1,								/* 1 byte					*/
	"SnsXfr",						/* actual sense bytes recieved*/
	1,								/* 1 byte					*/
	"Status",						/* status byte from request	*/
	1,								/* 4 bytes					*/
	"filler",						/* align to word			*/
	1								/* 4 bytes					*/
	}
};

/* The rest of the templates are neither required or standard, you can
   yank them and Sedit won't care */
/* the following templates are for viewing scsi manager data structures */
resource 'STMP' (12, "Driver Map") 
{
	{
	"Sig",							/* sbSig (sig word, $4552)	*/
	2,								/* 2 bytes					*/
	"BlkSiz",						/* sbBlkSize				*/
	2,								/* 2 bytes					*/
	"BlkCnt",						/* sbBlkCount				*/
	4,								/* 4 bytes					*/
	"DevTyp",						/* sbDevType				*/
	2,								/* 2 bytes					*/
	"DevID",						/* sbDevID					*/
	2,								/* 2 bytes					*/
	"Data",							/* sbData (reserved)		*/
	4,								/* 4 bytes					*/
	"DCount",						/* sbDrvrCount				*/
	2,								/* 2 bytes					*/
	"Block",						/* ddBlock					*/
	4,								/* 4 bytes					*/
	"Size",							/* ddSize					*/
	2,								/* 2 bytes					*/
	"Type",							/* ddType					*/
	2,								/* 2 bytes					*/
	"Repeat",						/* repeat the previous 3 fields */
	0x00000003						/* repeat until out of data */
	}
};

resource 'STMP' (13, "Old Part Map") 
{
	{
	"Sig",							/* pdSig (sig word, $5453)	*/
	2,								/* 2 bytes					*/
	"Start",						/* pdStart					*/
	4,								/* 4 bytes					*/
	"Size",							/* pdSize					*/
	4,								/* 4 bytes					*/
	"FSID",							/* pdFSID (file sys ID)		*/
	4,								/* 4 bytes					*/
	"Repeat",						/* repeat the previous 3 fields */
	0x00000003						/* repeat until out of data */
	}
};

resource 'STMP' (14, "New Part Map") 
{
	{
	"Sig",							/* pmSig (sig word, $504D)	*/
	2,								/* 2 bytes					*/
	"SigPad",						/* pmSigPad (reserved)		*/
	2,								/* 2 bytes					*/
	"BlkCnt",						/* pmMapBlkCnt				*/
	4,								/* 4 bytes					*/
	"PStart",						/* pmPylPartStart			*/
	4,								/* 4 bytes					*/
	"BlkCnt",						/* pmPartBlkCnt				*/
	4,								/* 4 bytes					*/
	"PName",						/* pmPartName				*/
	16,								/* 16 bytes					*/
	"PName",						/* pmPartName				*/
	16,								/* second 16 bytes			*/
	"PType",						/* pmPartType				*/
	16,								/* 16 bytes					*/
	"PType",						/* pmPartType				*/
	16,								/* second 16 bytes			*/
	"DStart",						/* pmLgDataStart			*/
	4,								/* 4 bytes					*/
	"DatCnt",						/* pmDataCnt				*/
	4,								/* 4 bytes					*/
	"Status",						/* pmPartStatus				*/
	4,								/* 4 bytes					*/
	"BStart",						/* pmLgBootStart			*/
	4,								/* 4 bytes					*/
	"BSize",						/* pmBootSize				*/
	4,								/* 4 bytes					*/
	"BLoad",						/* pmBootLoad				*/
	4,								/* 4 bytes					*/
	"BLoad2",						/* pmPBootLoad2				*/
	4,								/* 4 bytes					*/
	"BEntry",						/* pmBootEntry				*/
	4,								/* 4 bytes					*/
	"BEnty2",						/* pmBootEntry2				*/
	4,								/* 4 bytes					*/
	"BCheck",						/* pmBootCksum				*/
	4,								/* 4 bytes					*/
	"Proc",							/* pmProcessor				*/
	16,								/* 16 bytes					*/
	"Data",							/* boot specific arguments	*/
	16,								/* 128 bytes				*/
	"Repeat",						/* repeat the previous 1 field */
	0x00080001						/* repeat 8 times			*/
	}
};

resource 'STMP' (15, "MDB") 
{
	{
	"Sig",
	2,
	"CrDate",
	4,
	"LSMod",
	4,
	"Atrb",
	2,
	"NmFls",
	2,
	"VBMSt",
	2,
	"AllPtr",
	2,
	"NmABlk",
	2,
	"ABlkSz",
	4,
	"ClpSiz",
	4,
	"AlBlSt",
	2,
	"NxCNID",
	4,
	"FreBks",
	2,
	"VolNam",
	16,
	"VolNam",
	12,
	"VlBkUp",
	4,
	"SeqNum",
	2,
	"WrCnt",
	4,
	"XClpSz",
	4,
	"CClpSz",
	4,
	"RtDirs",
	2,
	"FilCnt",
	4,
	"DirCnt",
	4,
	"FndInf",
	16,
	"FndInf",
	16,
	"VCSize",
	2,
	"VCBM",
	2,
	"CtlCSz",
	2,
	"XTFlSz",
	4,
	"XTERec",
	12,
	"CTFlSz",
	4,
	"CTERec",
	12
	}
};


resource 'STMP' (16, "Boot Block") 
{
	{
	"Sig",
	2,
	"EntyPt",
	4,
	"Vers",
	2,
	"PageFl",
	2,
	"System",
	16,
	"Finder",
	16,
	"MacBug",
	16,
	"DisAsm",
	16,
	"StScrn",
	16,
	"StApp",
	16,
	"ClipBd",
	16,
	"NumFCB",
	2,
	"NumEvt",
	2,
	"128K",
	4,
	"256K",
	4,
	"512K",
	4,
	"Addr",
	16,
	"Repeat",	
	0x00000001	
	}
};
